package device

import (
	"gitee.com/rw555/fdsmastergo/pkg/keypad"
)

// Device 定义硬件设备接口
type Device interface {
	// 基本设备控制
	OpenPump() error
	ClosePump() error
	PumpIsRunning() (bool, error)
	SetPumpPower(duty int) error
	GetPumpPower() (int, error)

	OpenHeater1() error
	CloseHeater1() error
	IsHeater1Open() (bool, error)
	OpenHeater2() error
	CloseHeater2() error
	IsHeater2Open() (bool, error)

	GetTemp() int

	GetKeyState(key keypad.Key) (keypad.KeyState, error)
	AsKeypad() keypad.Keypad
}

// ExtendedDevice 扩展设备接口，支持更多功能
type ExtendedDevice interface {
	Device

	// 连接管理
	Connect() error
	Disconnect() error
	IsConnected() bool
	IsReady() bool

	// 串口设备特有功能
	SetBLEScanning(enable bool, filterName string) error
	SetKeyEventCallback(callback func(keypad.Event))
	SetStatusChangeCallback(callback func(string, interface{}))
}

// SerialDevice 串口设备特定接口
type SerialDevice interface {
	ExtendedDevice

	// BLE相关
	SetBLEEventCallback(callback func(interface{}))
}
